package org.noobie.photopicker.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;

import org.noobie.photopicker.R;

@SuppressLint("CheckResult")
public class LoadUtils {
    private static RequestOptions options = new RequestOptions();
    static {
        options.placeholder(R.drawable.ic_picture_loading) //未加载
                .error(R.drawable.ic_picture_loadfailed) //加载失败
                .dontAnimate(); //去除grid默认动画，否则可能显示有问题
    }

    public static void loadImage(Context context, String path, ImageView imageView) {
        Glide.with(context)
                .load(path)
                .apply(options)
                .into(imageView);
    }
}
